package com.kczd.jinlan.adapter.normaladapter;

import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

import com.kczd.jinlan.R;
import com.kczd.jinlan.model.Goods;

import java.util.List;

/**
 * zhangy
 * Created by Administrator on 2017/5/21.
 */

public class AfterPickingAdapter extends BaseCommAdapter<Goods> {

    public AfterPickingAdapter(List<Goods> datas) {
        super(datas);
    }

    @Override
    protected void setUI(ViewHolder holder, int position, final Context context) {
        Goods quanbu = getItem(position);

        TextView daizhifu_title_id = holder.getItemView(R.id.daizhifu_title_id);
        daizhifu_title_id.setText(quanbu.getTitle());

        TextView daizhifu_id_count = holder.getItemView(R.id.daizhifu_id_count);
        daizhifu_id_count.setText(quanbu.getWeight_dai());

        TextView text_price = holder.getItemView(R.id.daizhifu_id_price);
        text_price.setText(quanbu.getPrice());

        TextView text_place_time = holder.getItemView(R.id.daizhifui_id_time);
        text_place_time.setText(quanbu.getPay_time());

        TextView text_total = holder.getItemView(R.id.daizhifu_id_sum);
        text_total.setText("共" + quanbu.count + "个");
        TextView daizhifu_id_pricesum = holder.getItemView(R.id.daizhifu_id_pricesum);
        daizhifu_id_pricesum.setText(quanbu.getSumprice());
        TextView textView2 = holder.getItemView(R.id.textView2);
        textView2.setText(quanbu.getYunfei());

        Button but_cancel = holder.getItemView(R.id.daizhifu_id_cancle);
        but_cancel.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "查看物流", Toast.LENGTH_SHORT).show();
            }
        });

        Button but_payment = holder.getItemView(R.id.daizhifu_id_ok);
        but_payment.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Toast.makeText(context, "提醒发货", Toast.LENGTH_SHORT).show();
            }
        });
    }

    @Override
    protected int getLayoutId() {
        return R.layout.item_list_afterpicking;

    }
}
